using NUnit.Framework;
using ValidationFramework.Configuration;
using ValidationFramework.Extensions;
using ValidationFramework.Reflection;

namespace ValidationFramework.Tests.Configuration
{
    [TestFixture]
    public class RangeStringRuleConfigReaderTest
    {

        #region Methods

        [Test]
        public void ReadConfig()
        {
            const string validatorXml = "<rule errorMessage='hello' typeName='RangeStringRule' ruleSet='foo' minimum='a' maximum='c' equalsMinimumIsValid='false' equalsMaximumIsValid='false' />";
            var ruleData = (RuleData.Read(validatorXml.ToXmlReader()));
			var rule = (RangeStringRule)ConfigurationService.GetRule(ruleData, TypePointers.StringTypeHandle);
            Assert.AreEqual("hello", rule.ErrorMessage);
            Assert.AreEqual("a", rule.Minimum);
            Assert.AreEqual("c", rule.Maximum);
            Assert.IsFalse(rule.EqualsMinimumIsValid);
            Assert.IsFalse(rule.EqualsMaximumIsValid);

        }

        #endregion


    }
}